package Collestions_demo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class iterator_for1 {
    public static void main(String[] args) {
        Collection<String> sr = new ArrayList<>();
        sr.add("a");
        sr.add("b");
        sr.add("c");
        sr.add("d");
        sr.add("e");

        for (String ss:sr){
            System.out.println(ss);
        }
        Iterator it = sr.iterator();
        while (it.hasNext()) {
            String aa = (String) it.next();
            System.out.println(aa);
        }
    }
}
